package org.gnyxy.mapper;

import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.gnyxy.dto.CarouselPageQueryDTO;
import org.gnyxy.entity.Carousel;
import org.gnyxy.vo.TypeVO;

import java.util.List;

@Mapper
public interface CarouselMapper {
    @Insert("insert into carousel(image, description, status, deleted) values" +
            "(#{image},#{description},#{status},#{deleted})")
    void insert(Carousel carousel);

    @Select("select * from carousel where deleted = 0")
    Page<TypeVO> pageQuery(CarouselPageQueryDTO carouselPageQueryDTO);

    void update(Carousel carousel);

    @Select("select * from carousel where deleted = 0 and id = #{id}")
    Carousel getById(Long id);

    @Select("select * from carousel where deleted = 0 and status = 1")
    List<Carousel> getAll();
}
